package homework.day01;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Note {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("note.txt");
        Scanner scan = new Scanner(System.in);
        while(true){
            System.out.println("请输入内容:");
            String input = scan.nextLine();
            if("exit".equals(input)){
                System.out.println("已退出");
                break;
            }else{
                byte[] data = input.getBytes(StandardCharsets.UTF_8);
                fos.write(data);
                fos.write('\n');
            }
            System.out.println("内容已写入");
        }
        fos.close();
    }
}
